package activity;

import metier.Lame;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;

import com.example.horace.R;

import database.LameDatabase;

public class AjoutLameActivity extends Activity {

	private LameDatabase lame_db;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		lame_db = new LameDatabase(this);
		super.onCreate(savedInstanceState);
		setContentView(R.layout.ajout_lame_activity);
	}

	public void ajoutLame(View view){
		EditText longueurLame = (EditText) findViewById(R.id.longueurLame);
		EditText largeurLame = (EditText) findViewById(R.id.largeurLame);
		EditText libelleLame = (EditText) findViewById(R.id.libelleLame);
		String libelleLameString = libelleLame.getText().toString();
		Float longueurLameFloat = Float.valueOf(longueurLame.getText().toString());
		Float largeurLameFloat = Float.valueOf(largeurLame.getText().toString());
		lame_db.insertLame(new Lame(libelleLameString, largeurLameFloat, longueurLameFloat));
	}

	

}
